<template>
  <el-card shadow="hover" style="height: 100%;" :body-style="{height:'100%'}">
    <template #header>
      <nav class="flex justify-between">
        <span>对数据进行分组</span>
        <el-link type="primary" target="_blank" href="https://www.lodashjs.com/docs/lodash.groupBy">groupBy</el-link>
      </nav>
    </template>

    <div>
      {{mapList}}
    </div>
    <hr>
    <div>
      {{groupBy(mapList,'name')}}
    </div>
  </el-card>
</template>

<script setup lang="ts">
import {groupBy} from 'lodash-es'

const mapList = [
	{
		everyCount: 5,
		name: "NB 物联网表",
		code: "nb",
		id: "8cfc89181f664c629e4d7c66fb830e81",
		rate: 100
	},
	{
		everyCount: 6,
		name: "NB 物联网表",
		code: "nb",
		id: "8cfc89181f664c629e4d7c66fb830e81",
		rate: 102
	},
	{
		everyCount: 6,
		name: "普表",
		code: "nb",
		id: "8cfc89181f664c629e4d7c66fb830e81",
		rate: 102
	},
	{
		everyCount: 5,
		name: "普表",
		code: "nb",
		id: "8cfc89181f664c629e4d7c66fb830e81",
		rate: 102
	}
]


console.log(groupBy(mapList,'name'))
</script>

<style scoped lang="less">

</style>
